package com.changyue.activity.launch;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

import com.changyue.activity.basic.BasicActivity;
import com.changyue.activity.home.HomeActivity;
import com.changyue.bleHelper.BLEDeviceConfig;
import com.changyue.temp.BuildConfig;
import com.changyue.temp.databinding.ActivityLaunchBinding;
import com.changyue.util.AppUtils;

public class LaunchActivity extends BasicActivity {

    private ActivityLaunchBinding binding;


    public static void start(Context context) {
        Intent intent = new Intent(context, LaunchActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = ActivityLaunchBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        initView();

    }

    public void initView() {

        String versionInfo = "V " + AppUtils.getVersionName(this) + "(" + AppUtils.versionCode(this) + ")" + (BuildConfig.DEBUG ? "测试环境" : "");
        binding.version.setText(versionInfo);

        BLEDeviceConfig.readConfig(LaunchActivity.this);
        (new Handler()).postDelayed(new Runnable() {
            @Override
            public void run() {
                HomeActivity.start(LaunchActivity.this);
                finish();
            }
        }, 3000);
    }
}